package com.xz.courseschedule.controller;

import com.xz.courseschedule.common.dto.CourseTypeDistributionDto;
import com.xz.courseschedule.common.dto.RoomUsageDto;
import com.xz.courseschedule.service.DashboardService;
import com.xz.courseschedule.utils.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 数据统计控制器
 * @Author: zys
 * @CreateTime: 2025-06-03
 */
@Tag(name = "数据统计", description = "系统数据统计和可视化相关接口")
@RestController
@RequestMapping("/dashboard")
public class DashboardController {

    @Autowired
    private DashboardService dashboardService;

    @Operation(summary = "获取课程类型分布", description = "统计不同类型课程（理论课、实验课、实践课、体育课）的分布情况")
    @GetMapping("/course-types")
    public Result<List<CourseTypeDistributionDto>> getCourseTypes() {
        return dashboardService.getCourseTypeDistribution();
    }

    @Operation(summary = "获取教室使用情况", description = "统计各时间段教室的使用情况和使用率")
    @GetMapping("/room-usage")
    public Result<RoomUsageDto> getRoomUsage() {
        return dashboardService.getRoomUsage();
    }
}